package main

import "fmt"

func main() {
	nickShop := NikeShop{
		name: "nick2",
	}
	anta := AnteShop{
		name: "anta2",
	}
	//shoe := nickShop.MakeShoe()
	//fmt.Println(shoe)
	beginMake(&nickShop)
	beginMake(&anta)
}

type Shoe interface {
	MakeShoe() error
}
type NikeShop struct {
	name string
}
type AnteShop struct {
	name string
}

/**
  只要实现了接口的方法集，函数签名正确就可以，非侵入式接口挺好用哈
*/
func (nick *NikeShop) MakeShoe() error {
	fmt.Println(nick.name)
	return nil
}
func (anta *AnteShop) MakeShoe() error {
	fmt.Println(anta.name)
	return nil
}

/**
接口作为参数
*/
func beginMake(shop Shoe) error {
	return shop.MakeShoe()
}
